package dao;

import java.sql.*;

public class ConnectionManager {
        private static Connection connection;
        private static Statement command;

        private static String driver = "org.apache.derby.jdbc.EmbeddedDriver";

        public static void connect(String path)
        throws ClassNotFoundException, SQLException
        {
            Class.forName(driver);
            connection = DriverManager.getConnection("jdbc:derby:"+path+";create=true");
            command = connection.createStatement();
        }

        static Statement getStatement()
        throws SQLException
        {
                if (connection == null) {
                        throw new SQLException("Not connected yet!");
                }

                return command;
        }
}
